using System;
using CSW.Framework.Common;

namespace CSW.Framework.UI.Binding
{
    /// <summary>
    /// NewRecordEventArgs. See <see cref="NewRecordEventHandler{T}"/>.
    /// </summary>
    public class NewRecordEventArgs<T> : EventArgs
    {
        private readonly T m_Item;

        /// <summary>
        /// Initializes a new instance of the <see cref="NewRecordEventArgs{T}"/> class.
        /// </summary>
        /// <param name="item">The new item.</param>
        public NewRecordEventArgs(T item)
        {
            Guard.ArgumentNotNull(item, "item");

            m_Item = item;
        }

        /// <summary>
        /// Gets the new record item.
        /// </summary>
        /// <value>The new record item.</value>
        public T Item
        {
            get { return m_Item; }
        }

        /// <summary>
        /// Gets or sets a value indicating whether the record should be removed.
        /// </summary>
        /// <value><c>true</c> if the record should be removed; otherwise, <c>false</c>.</value>
        public bool Remove { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this <see cref="NewRecordEventArgs&lt;T&gt;"/> is handled.
        /// </summary>
        /// <value><c>true</c> if handled; otherwise, <c>false</c>.</value>
        public bool Handled { get; set; }
    }
}
